package com.exam.Service;

import com.exam.Entity.ExamManage;
import com.exam.Entity.Student;
import com.exam.Mapper.ExamManageMapper;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExamManageService {
    @Autowired
    private ExamManageMapper examManageMapper;



    public List<ExamManage> findAll() {
        return examManageMapper.findAll();
    }

    public List<ExamManage> findTotal(int page, int size) {

            List<ExamManage> result = examManageMapper.findAll();

        return result;
    }
    public List<ExamManage> findAll(int page, int size) {
        //设置分页参数
        PageHelper.startPage(page, size);
        //执行查询
        List<ExamManage> result = examManageMapper.findAll();
        // 包装分页结果
        PageInfo<ExamManage> pageInfo = new PageInfo<>(result);

        return pageInfo.getList();
    }


    public ExamManage findById(Integer examCode) {
        return examManageMapper.findById(examCode);
    }


    public int delete(Integer examCode) {
        return examManageMapper.delete(examCode);
    }


    public int update(ExamManage exammanage) {
        return examManageMapper.update(exammanage);
    }


    public int add(ExamManage exammanage) {
        return examManageMapper.add(exammanage);
    }


    public ExamManage findOnlyPaperId() {
        return examManageMapper.findOnlyPaperId();
    }
}
